<template>
  <div class="dashboard-editor-container">
<!--    <PanelGroup @handleSetLineChartData="handleSetLineChartData"/>-->

    <el-card class="increase">
      <Increase :chart-data="lineChartData" :yTittle="yTitle"/>
    </el-card>

    <el-row :gutter="20" class="chart-row">
      <el-col :xs="24" :sm="24" :lg="12">
        <el-card>
          <Registered />
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="12">
        <el-card>
          <stackedArea />
        </el-card>
      </el-col>
    </el-row>

<!--    <el-row :gutter="20">-->
<!--      <el-col :xs="24" :sm="24" :lg="8">-->
<!--        <el-card>-->
<!--&lt;!&ndash;          <stackedArea />&ndash;&gt;-->
<!--        </el-card>-->
<!--      </el-col>-->
<!--      <el-col :xs="24" :sm="24" :lg="8">-->
<!--        <el-card>-->
<!--&lt;!&ndash;          <bar-chart2 />&ndash;&gt;-->
<!--        </el-card>-->
<!--      </el-col>-->
<!--      &lt;!&ndash;<el-col :xs="24" :sm="24" :lg="8">-->
<!--        <el-card>-->
<!--          <pie-chart2/>-->
<!--        </el-card>-->
<!--      </el-col>&ndash;&gt;-->
<!--    </el-row>-->
  </div>
</template>

<script>
import Registered from "components/page/client/clientAnalyse/components/Registered";
import Increase from "components/page/client/clientAnalyse/components/Increase";
import stackedArea from "components/page/client/clientAnalyse/components/stackedArea";
const lineChartDatas = {
  purchases: {
    allOrder: [160, 120, 150, 170, 160, 100,130],
    waitOrder: [130, 100, 121, 104, 105, 90, 100],
    doingOrder: [120, 90, 100, 138, 142, 130, 130],
    finishOrder: [30, 60, 100, 80, 40, 50, 20],
    refundOrder: [10, 5, 15, 3, 12, 4, 9]
  },
  /*shoppings: {
    waitOrder: [130, 140, 141, 142, 145, 150, 160],
    doingOrder: [120, 82, 91, 154, 162, 140, 130]
  },
  newUsers: {
    waitOrder: [100, 120, 161, 134, 105, 160, 165],
    doingOrder: [120, 82, 91, 154, 162, 140, 145]
  },
  messages: {
    waitOrder: [200, 192, 120, 144, 160, 130, 140],
    doingOrder: [180, 160, 151, 106, 145, 150, 130]
  },*/
}

const yTitles = {
  purchases: '订单数量(个)',
  /*shoppings: '订单数量(个)',
  newUsers: '客户数量(人)',
  messages: '消息数量(条)',*/
}

export default {
  name: 'DashBoard',

  data() {
    return {
      lineChartDatas: [],
      // lineChartData: lineChartDatas.purchases,
      lineChartData: {},
      yTitle: yTitles.purchases
    }
  },

  mounted () {
    setTimeout(() => {
      this.lineChartDatas = lineChartDatas
      this.lineChartData = lineChartDatas.purchases
    }, 1000);
  },

  methods: {
    handleSetLineChartData(type) {
      this.yTitle = yTitles[type]
      this.lineChartData = lineChartDatas[type]
    }
  },

  components: {
    Registered,
    Increase,
    stackedArea,
    // BarChart,
    // PieChart,
    // LineChart2,
    // BarChart2,
    // PieChart2,
  }
}
</script>

<style lang="less" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  .increase{
    margin-bottom: 20px;
  }
  .chart-row {
    margin-bottom: 32px;
  }
}
</style>
